package com.example.controller;

import com.example.pojo.Chat;
import com.example.pojo.Result;
import com.example.service.ChatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class ChatController {
    @Autowired
    private ChatService chatService;
    @PostMapping("/chat")
    public Result chat(@RequestBody Chat chat) {

        log.info("聊天室  --->>>  当前JWT：{}，当前消息：{}",chat.getJwt(),chat.getMessage());
        chatService.chat(chat);
        return Result.success();

    }
}
